const xss = require('xss');
const source = '<a href="#">baidu</a><script type="text/javascript">alert("foo")</script><img src="img1">a<img src="img2">b<img src="img3">c<img src="img4">d';
const list = [];
xss(source, {
    onTagAttr(tag, name, value, isWhiteAttr) {
        if (tag === 'img' && name === 'src') {
            list.push(xss.friendlyAttrValue(value));
        }
    }
});

console.log('image list:\n%s', list.join(', '));

console.log('xss.friendlyAttrValue: ', xss.friendlyAttrValue.toString());
